home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / libs / unixlib.lha / unix / test / sigprocmask_test.c < prev   
C/C++ Source or Header  |  1996-01-04  |  575b  |  21 lines

  1. #include <stdio.h>
  2. #include <signal.h>
  3. #include <unistd.h>
  4.  
  5. int main(void)
  6. {
  7.    int i;
  8.    const sigset_t trapped = sigmask(SIGINT);
  9.    puts("The following is unbreakable");
  10.    sleep(1);
  11.    sigprocmask(SIG_BLOCK, &trapped, NULL);
  12.    for (i = 0; i < 100; ++i) printf("1 %d\n", i);
  13.    puts("The following may be broken out of");
  14.    puts("(will break immediately if you hit ^C previously)");
  15.    sleep(1);
  16.    sigprocmask(SIG_UNBLOCK, &trapped, NULL);
  17.    for (i = 0; i < 100; ++i) printf("2 %d\n", i);
  18.    puts("Hey! You never hit ^C!  What kind of test is this?");
  19.    return(0);
  20. }
  21.